<? 
	$title="Edit category"; 
	$pageid="5";
	$accessid="a00";
	
	require("required/dbconnect.php"); 
	require("required/function.php");
	
	if(isset($_POST['btnsubmit']))
	{
		$engname=$_POST['engname'];
		$status=$_POST['status'];
		$area_type=$_POST['area_type'];
		$id=$_POST['id'];
		
		mysql_query("update os_country set engname='$engname',status='$status',area_type='$area_type' where id=$id")or die(mysql_error());
		header("Location:country_view_full.php?id=$id");		
	}
	
	require("required/header.php");
	checkAccess("allow_shipping_management",1);
	
	
	
	
	
	$id=$_GET['id'];

	$get_info=mysql_query("select * from os_country where id=$id");
	
	if(mysql_num_rows($get_info)==0)
	{
		echo "No record found!!";
	}
	else
	{
		

	$a=mysql_fetch_array($get_info,MYSQL_ASSOC);
	
	if($a['status']==0)
	{
		$slt0="selected";
		$slt1="";
		
	}
	else
	{
		$slt0="";
		$slt1="selected";
	}
	
?>
<table width="95%" cellpadding="2" cellspacing="1">
	
	<td valign="top">
	<table>
	<tr>
		<td colspan="4" class="title">Edit Country</td>
	</tr>
	<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" name="frm" onSubmit="return frmValidate(this)">
	
	<tr>
		<td width="25%">Country Name</td><td width="2%">:</td><td width="80%"><input type="text" size="30" name="engname" class="text" value="<?= $a['engname'] ?>"></td>
	</tr>
    <?
		if($a['area_type']=="")
		{
			$area_type="State";
		}else{
			$area_type=$a['area_type'];
		}
	?>
     <tr>
        <td>Area Type</td><td width="2%">:</td><td><input type="text" name="area_type" class="text" value="<?= $area_type ?>" /> E.g. : Province, State, District and etc </td>
    </tr>
    <tr>
        <td>Show at website</td><td width="2%">:</td>
        <td>
            <select name="status" class="text">
                <option value="0" <?= $slt0 ?>>No</option>
                <option value="1" <?= $slt1 ?>>Yes</option>
            </select>	
        </td>
    </tr>
	<tr>
		<td colspan="3" align="center"><br>
      
        	<input type="submit" value="Update" class="button" name="btnsubmit">  
            <input type="hidden" value="<?= $id ?>" name="id">  
       
        	<input type="button" value="Cancel" class="button" onclick="window.open('country_view_full.php?id=<?= $id ?>','_self')"><br><br>
        </td>
	</tr>
    
	</form>
	</table></td>
			
</table>
<? } require("required/footer.php"); ?>

